<template>
  <div class="app-container">
    <el-dialog :title="'生产进度'+'（'+form.orderNo+'）'" :visible.sync="dialogVisible" width="50%" append-to-body>
      <el-table
        :data="list"
        maxHeight="500"
        v-loading="loading"
      >
        <el-table-column type="index" label="序号" align="center"></el-table-column>
        <el-table-column prop="stepName" label="工序名称" align="center"/>
        <el-table-column prop="allNum" label="总数量" align="center"/>
        <el-table-column prop="completedNum" label="完成数量" align="center"/>
        <el-table-column prop="invalidNum" label="不合格数量" align="center"/>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible=false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {getProduceProcess} from "../../../../api/produceMng";

export default {
  dicts: ['sys_material_type', 'sys_yes_no'],
  data() {
    return {
      loading: false,
      dialogVisible: false,
      form: {},
      list: [],
      bomList: []
    }
  },
  methods: {
    show(form) {
      this.list = []
      this.form = {}
      this.resetForm('form')
      this.form.id = form.id
      this.form.orderNo = form.orderNo
      this.dialogVisible = true
      this.load()
    },
    load() {
      this.loading = true
      getProduceProcess({reOrderNo: this.form.orderNo}).then(res => {
        this.list = res.data
      }).finally(e => {
        this.loading = false
      })
    }
  }
}
</script>
